﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>心里测试</title>
	<script src="../js/jquery-3.2.1.min.js"></script>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="../css/bootstrap.min.css" >	
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="../js/bootstrap.min.js" ></script>
	<link rel="stylesheet" type="text/css" href="../css/index.css">
</head>
<body>
	<div>
	<nav class="navbar navbar-default navbar-fixed-top top" >
		<a href="../"><img class="top_left" src="../images/log.png"></a>
		<div class="pull-right" style="margin-top: 15px;margin-right: 20px;">
			<a href="http://www.xinli001.com/ceshi">关于心理测试</a>
		</div>
		</nav>
	</div>	
	<br>
	<br>
			<!-- 连接数据库 -->
			<?php
				mysql_connect("localhost","root","root");
				mysql_query("set names utf8 "); 
				// 执行sql语句
				$query="select * from question";
				$result = mysql_db_query("psychology","$query");
			?>
			<!-- 输出问题 -->
				<div>
				<form action="result.php" method="post" style="margin-left: 50px;">
				<?php
					while ($data= mysql_fetch_object($result)) {
						# code...
						?>
						<h1><?php echo $data->questionNum?>: <?php echo $data->questionPart;?></h1>
						<div style="margin-left: 50px;">
						<input type='radio' name='result<?php echo $data->questionNum?>' value='<?php echo $data->answerA ; ?>' />A.<?php echo $data->answerA ; ?><br />
						<input type='radio' name='result<?php echo $data->questionNum?>' value='<?php echo $data->answerB ; ?>' />B.<?php echo $data->answerB ; ?><br />
						<input type='radio' name='result<?php echo $data->questionNum?>' value='<?php echo $data->answerC ; ?>' />C.<?php echo $data->answerC ; ?><br />
						<input type='radio' name='result<?php echo $data->questionNum?>' value='<?php echo $data->answerD ; ?>' />D.<?php echo $data->answerD ; ?><br />
						</div>
						<?php
					}
				?>

			<input type="submit" name="提交" class="btn  " style="width: 200px; margin-left: 80%;" />
			</form>
		</div>

		<!-- 版权 -->
		<div  style="text-align:center">
			<hr>
			<font>©2018 chenshuwei AND yangliu.<br/>All Rights Reserved.<br/>
			电话：0991-123456</font>
		</div>

		
</body>
</html>